package com.hodgepodge.commons.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.hodgepodge.commons.base.entity.SuperEntity;
import com.hodgepodge.commons.validator.annotation.FixedNumValues;
import com.hodgepodge.commons.validator.group.Insert;
import com.hodgepodge.commons.validator.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * <p>
 * 角色
 * </p>
 *
 * @author jiangjian
 * @since 2021-07-06
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "角色")
public class Role extends SuperEntity<Role> {

    private static final long serialVersionUID = 6552571344609987656L;

    /**
     * 角色ID
     */
    @ApiModelProperty(value = "角色ID")
    @NotBlank(message = "角色ID不能为空", groups = Update.class)
    @TableId("role_id")
    private Long roleId;

    /**
     * 角色名称
     */
    @ApiModelProperty(value = "角色名称")
    @NotNull(message = "角色名称不能为空", groups = Integer.class)
    @Length(max = 20, message = "角色名称不能超过20个字符", groups = {Insert.class, Update.class})
    private String name;

    /**
     * 角色介绍
     */
    @ApiModelProperty(value = "角色介绍")
    @Length(max = 255, message = "角色介绍不能超过255个字符", groups = {Insert.class, Update.class})
    private String intro;

    /**
     * 角色状态(0:正常 1:禁用)
     */
    @ApiModelProperty(value = "角色状态(0:正常 1:禁用)")
    @FixedNumValues(values = {0, 1}, message = "角色状态只能是(0:正常 1:禁用)", groups = {Insert.class, Update.class})
    private Integer state;

}
